
package com.googlecode.xapper

import static org.junit.Assert.*
import static org.junit.Assume.*
import static org.hamcrest.Matchers.*

import org.junit.*
import org.junit.runner.*
import org.junit.experimental.theories.*

import nu.xom.*

import com.googlecode.xapper.ReadyMades


@RunWith(Theories.class)
public class TestTheoryReadyMadeHeadingsHaveRightLevels{
	
	@DataPoints public static int[] levels = [1, 2, 3, 4, 5, 6, 7, 8, 9, 10]

	@Theory
	public void shouldCreateATagWithTheSpecifiedLevel(int level) {
		assumeThat(level, is(lessThan(7)))
		
		def element = ReadyMades.heading(level)
		
		assertThat(element.getLocalName(), is(equalTo(String.format("h%d", level))))
	}
	
	public void shouldNotAllowAHeadingLevelGreaterThanSix(int level) {
		assumeThat(level, is(greaterThan(6)))
		
		ReadyMades.heading(level)
	}
}
